﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.Net.Http;
using System.Net;

namespace Travel.Api.Code
{
    public enum ErrorCodes
    {
        [Description("Pin not found")]
        NotValidPin = 1,
        [Description("Travel not found")]
        TravelNotFound = 2,
        [Description("Travel not belong to client")]
        TravelNotByUser = 3
    }

    public class ErrorUtils
    {
        public static HttpResponseMessage GetErrorResponse(ErrorCodes code)
        {
            return new HttpResponseMessage(HttpStatusCode.InternalServerError)
            {
                Content = new StringContent(string.Format("{{\"ErrorNumber\":{0}, \"ErrorMessage\":\"{1}\"}}", Convert.ToInt32(code).ToString(), Utils.GetEnumDescription(code))),
            };
        }
    }
    
}